package GraphTheory;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;

class Solver1080
{	int n;
	int[] Visited;
	int[][] Map;
	
	public void Input() throws IOException
	{	StreamTokenizer in=new StreamTokenizer(new InputStreamReader(System.in));
		in.nextToken();n=(int)in.nval;
		Visited=new int[n+1];Arrays.fill(Visited,-1);
		Map=new int[n+1][n+1];
		for (int i=1;i<=n;i++) Arrays.fill(Map[i],0);
		for (int i=1;i<=n;i++)
		{	while(true)
			{	in.nextToken();int f=(int)in.nval;
				if (f!=0)
				{	Map[i][f]=1;Map[f][i]=1;
				}
				else break;
			}
		}
	}
	public void Solve()
	{	Queue<Integer> Q=new LinkedList<Integer>();
		Q.add(1);Visited[1]=0;
		while (!Q.isEmpty())
		{	int f=Q.remove();
			for (int i=1;i<=n;i++)
				if (Map[f][i]==1)
				{	if (Visited[i]==-1)
					{	Visited[i]=1-Visited[f];
						Q.add(i);
					}
					else if (Visited[i]!=1-Visited[f])
					{	Output(false);
						return;
					}
				}
		}
		Output(true);
	}
	public void Output(boolean b)
	{	if (b)
		{	for (int i=1;i<=n;i++)
				System.out.print(Visited[i]);
			System.out.println();
		}
		else System.out.println(-1);
	}
	public void main() throws IOException
	{	Input();Solve();
	}
}
public class P1080
{	public static void main(String[] args) throws IOException
	{	Solver1080 solver=new Solver1080();
		solver.main();
	}
}
